package com.rd.student.jike.class1.guojiabao.exam;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
import java.util.Scanner;

public class StudentInformation {
    public static void main(String[] args) throws IOException {
        File file = new File("studentInformation.txt");
        Writer writer = new FileWriter(file);
        String s = "姓名 语文成绩 数学成绩   总分";
        writer.write(s);
        writer.write('\n');
        for (int i = 0; i < 3; i++) {
            int count = 0;
            String name = studentName();
            int yuwen = languageNum();
            int shuxue = mathNum();
            count = yuwen + shuxue;
            writer.write(name+" ");
            writer.write("   "+yuwen+"   ");
            writer.write("   "+shuxue+"    ");
            writer.write(" "+count+" ");
            writer.write('\n');
        }
        writer.close();
    }
    public static String studentName(){
        System.out.println("请输入学生姓名：");
        Scanner sc = new Scanner(System.in);
        String name = sc.next();
        return name;
    }
    public static int languageNum(){
        System.out.println("请输入语文成绩：");
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
        return num;
    }
    public static int mathNum(){
        System.out.println("请输入数学成绩：");
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
        return num;
    }
}
